import { recipeDatabase } from './recipe-database'

// 获取所有菜谱（内置+自定义）
export async function getAllRecipes() {
  const customRecipes = uni.getStorageSync('custom') || []
  // 直接拼接内置和自定义菜谱，保留自定义菜谱的全部字段
  return [...recipeDatabase, ...customRecipes]
}

// 根据ID获取菜谱
export async function getRecipeById(id) {
  const all = await getAllRecipes()
  return all.find(r => r.id === id)
} 